﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataObject.DataAccess;

public partial class Pages_Operators_Ascx_ServiceProviderPopup : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // Load Provider
            foreach (var item in ProviderDAO.CreateInstant().GetAll())
            {
                var listItem = new ListItem
                {
                    Text = item.ProviderNumber,
                    Value = item.ProviderName
                };
                listItem.Attributes.Add("ProviderID", item.ProviderID.ToString());
                this.ddlProviderNumberInput.Items.Add(listItem);
            }

            for (int i = 0; i < define.Unit.Length; i++)
            {
                ListItem item = new ListItem
                {
                    Value = i.ToString(),
                    Text = define.Unit[i]
                };
                if (i == 0)
                    item.Selected = true;
                this.ddlUnit.Items.Add(item);
                this.ddlUnit1.Items.Add(item);
            }

            this.ddlUnitCurrency.Items.AddRange(DropDownListHelper.Currencies);
            this.ddlCurrency.Items.AddRange(DropDownListHelper.Currencies);

            this.ddlUnitCurrency.SelectedIndex = 1;
            this.ddlCurrency.SelectedIndex = 1;
        }
    }
}
